package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;

/**
 * Klasse erzeugt ein Benachrichtungsfenster, falls Aktionen nicht möglich sind
 * und gibt u.U. weitere Informationen aus
 * 
 * @author Michi
 * 
 */
public class NotifyFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4610089224719130356L;
	private JPanel contentPane;
	private JTextArea textArea;

	public JTextArea getTextArea() {
		return textArea;
	}

	public void setTextArea(JTextArea textArea) {
		this.textArea = textArea;
	}

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					NotifyFrame frame = new NotifyFrame("test123");
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public NotifyFrame(String message) {
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));

		textArea = new JTextArea();
		textArea.setText(message);
		textArea.setSize(new Dimension(400, 200));
		textArea.setMaximumSize(new Dimension(400, 200));
		textArea.setMinimumSize(new Dimension(400, 200));
		textArea.setMargin(new Insets(30, 30, 30, 30));
		textArea.setEditable(false);
		textArea.setEnabled(false);
		textArea.setBackground(new Color(238, 238, 238));
		textArea.setPreferredSize(new Dimension(400, 200));
		textArea.setDisabledTextColor(Color.BLACK);
		contentPane.add(textArea, BorderLayout.NORTH);

		JButton btnOk = new JButton("OK");
		btnOk.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		contentPane.add(btnOk, BorderLayout.SOUTH);
	}
}
